package com.example.mobile2021606129ly0330;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity_li extends AppCompatActivity {

    private EditText edLi;
    private Button butLiRes;
    private TextView textLiRes;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_li);
        initView();
        butLiRes.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int profit = Integer.parseInt(edLi.getText().toString());
                if (profit <= 100000) {
                    double a = profit * 0.01;
                    textLiRes.setText('a');
                    if (100000 < profit && profit <= 200000) {
                        double b = 100000 * 0.01;
                        int c = profit - 100000;
                        double d = c * 0.75;
                        double e = b + d;
                        textLiRes.setText('e');
                        if (200000 < profit && profit <= 400000) {
                            double f = 100000 * 0.01 + 100000 * 0.075;
                            double g = (profit - 200000) * 0.05;
                            double h = f + g;
                            textLiRes.setText('h');
                            if (400000 < profit && profit <= 600000) {
                                double i = 100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + (profit - 400000) * 0.03;
                                textLiRes.setText('i');
                                if (600000 < profit && profit <= 1000000) {
                                    double j = 100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.3 + (profit - 600000) * 0.015;
                                    textLiRes.setText('j');
                                    if (profit > 1000000) {
                                        double k = 100000 * 0.1 + 100000 * 0.75 + 200000 * 0.05 + 200000 * 0.03 + 400000 * 0.015 + (profit - 1000000) * 0.015;
                                        textLiRes.setText('k');
                                    }
                                }
                            }
                        }
                    }
                }
            }
        });
    }

    private void initView() {
        edLi = (EditText) findViewById(R.id.ed_li);
        butLiRes = (Button) findViewById(R.id.but_li_res);
        textLiRes = (TextView) findViewById(R.id.text_li_res);
    }
}